package com.woorigil.social.domain.flower;

import java.util.List;

import org.springframework.stereotype.Repository;
import com.woorigil.social.domain.SqlMapDaoSupport;

@Repository
public class FlowerTagRefDao extends SqlMapDaoSupport<FlowerTagRef, Integer> {
	public static final String NAMESPACE = "FlowerTagRef";

	@Override
	public String getNamespace() {
		return NAMESPACE;
	}

	@SuppressWarnings("unchecked")
	public List<FlowerTagRef> search() {
		return getSqlMapClientTemplate().queryForList(getStatementName(NAMESPACE, "search"), null);
	}
	
	@SuppressWarnings("unchecked")
	public List<FlowerTagRef> selectListByFlowerId(int flowerId) {
		return getSqlMapClientTemplate().queryForList(getStatementName(NAMESPACE, "selectListByFlowerId"), flowerId);
	}
	
	@SuppressWarnings("unchecked")
	public List<FlowerTagRef> selectListByTagId(int tagId) {
		return getSqlMapClientTemplate().queryForList(getStatementName(NAMESPACE, "selectListByTagId"), tagId);
	}

	public int deleteByFlowerId(int flowerId) {
		return getSqlMapClientTemplate().delete(getStatementName(NAMESPACE, "deleteByFlowerId"), flowerId);
	}
}